#ifndef CONFIG_H
#define CONFIG_H
#include<map>
#include<string>
#include<iostream>
using namespace std;



typedef struct server_config{
// for resource
	unsigned int maxFileLen;
	unsigned int minFileLen;
	unsigned int resourceNumber;

// for resource server
	unsigned int rsBandwidth;
	unsigned int rsNumber;
	unsigned int heartBeatTimeInterval;
	unsigned int subMaxRsLoad;
	unsigned int infMaxRsLoad;

//for lb server
	unsigned int dwTimeInterval;
	double spreadThreshold;
	bool needSpread;
	string  serverPort;
	string managerPort;
	string statisticalResultFile;
	unsigned int statisticalTimeInterval;
}ServerConfigType;


typedef struct client_config{
	unsigned int clientNumber;
	double poissonLambda;
	unsigned int resourceNumber;
	double 	zipfParameter ;
	string serverPort;
	string serverIpAddress;
	string requestListFile;
	unsigned int clientBandwidth;
}ClientConfigType;

int parse_config_line(const string &line,string &key,string &value );
int read_server_config(const string filename , ServerConfigType &serverConfig);
int read_client_config(const string filename, ClientConfigType &);

int read_config_file(const string filename, map<string,string>& conf_map);
#endif
